<ui:composition template="/admin/templates/ui2.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:composite="http://java.sun.com/jsf/composite/primefaces"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:sec="http://www.springframework.org/security/facelets/tags">

	<ui:define name="content">
		<div class="entry">
			<p:toolbar>
				<p:toolbarGroup>
						<h:outputLabel style="padding-left: 15px;"
							value="#{commonMsg.currentPositionLabel}我的订单"></h:outputLabel>


				</p:toolbarGroup>
				
			</p:toolbar>
			<h:form id="form">


				<p:dataTable lazy="true" id="dataTable"
					value="#{myOrderList.lazyModel}" var="userOrder" paginator="true"
					paginatorPosition="bottom" rows="15" sortBy="userOrder.dateBetween" sortOrder="descending"
					currentPageReportTemplate="#{commonMsg.pageReportTemplate}"
					paginatorTemplate="#{commonMsg.paginatorTemplate}"
					rowsPerPageTemplate="15,50,100"
					emptyMessage="#{commonMsg.noResultMsg}">

					<p:column>
						<f:facet name="header">
							<h:outputText value="谁订的"></h:outputText>
						</f:facet>
						<h:outputText value="#{userOrder.user.realname}"></h:outputText>

					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="菜单日期"></h:outputText>
						</f:facet>
						<h:outputText value="#{userOrder.dateBetween}"></h:outputText>
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="订了几天的"></h:outputText>
						</f:facet>
						<h:outputText value="#{userOrder.count}"></h:outputText>
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="花多少钱"></h:outputText>
						</f:facet>
						<h:outputText value="#{userOrder.money}"></h:outputText>
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="我都订了些啥啊"></h:outputText>
						</f:facet>
						<p:commandButton type="button" id="userDayFoodDetailButton" value="我瞅瞅">
							<p:ajax listener="#{myOrderList.setUserOrder(userOrder)}"
								update=":form:userDayFoodDetailDialog" oncomplete="userDayFoodDetailDialog.show()"
								event="click"></p:ajax>
						</p:commandButton>
					</p:column>


					

				</p:dataTable>
				
				
				<p:dialog id="userDayFoodDetailDialog" header="我瞅瞅我都订啥了"
					widgetVar="userDayFoodDetailDialog" modal="true">


					<p:dataTable lazy="true" id="dataTable1"
						value="#{myOrderList.userDayFoodList}" var="udf" paginator="true"
						paginatorPosition="bottom" rows="15"
						currentPageReportTemplate="#{commonMsg.pageReportTemplate}"
						paginatorTemplate="#{commonMsg.paginatorTemplate}"
						emptyMessage="#{commonMsg.noResultMsg}">

						<p:column>
							<f:facet name="header">
								<h:outputText value="日期"></h:outputText>
							</f:facet>
							<h:outputText value="#{udf.date}">
								<f:convertDateTime pattern="yyyy-MM-dd" timeZone="GMT+8"></f:convertDateTime>
							</h:outputText>

						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="星期几啊"></h:outputText>
							</f:facet>
							<h:outputText value="#{dateUtil.getWeek(udf.date).getChineseName()}"></h:outputText>

						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="我订早饭了么？"></h:outputText>
							</f:facet>
							<h:outputText value="订了" rendered="#{udf.breakfast eq 'yes'}"></h:outputText>
							<h:outputText value="没订" rendered="#{udf.breakfast eq 'no'}"></h:outputText>

						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="午饭我订啥了"></h:outputText>
							</f:facet>
							<h:outputText value="#{myOrderList.getFoodName(udf.date)}" rendered="#{udf.lunch eq 'yes'}"></h:outputText>
							<h:outputText value="没订" rendered="#{udf.lunch eq 'no'}"></h:outputText>

						</p:column>
						<f:facet name="footer">
						<p:commandButton value="导出Excel" ajax="false">
							<p:dataExporter target="dataTable1" type="xls"
								fileName="myOrderList" pageOnly="false"></p:dataExporter>
						</p:commandButton>
					</f:facet>
						
					</p:dataTable>
				</p:dialog>


				
			</h:form>
		</div>
	</ui:define>
</ui:composition>
